import request from '@/utils/request'

// 查询文件列表
export function listFiles(query) {
    return request({
        url: '/system/file/list',
        method: 'get',
        params: query
    })
}

// 上传文件
export function uploadFile(data) {
    return request({
        url: '/system/file/upload',
        method: 'post',
        data: data,
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    })
}

// 下载文件
export function downloadFile(fileId) {
    return request({
        url: `/system/file/download/${fileId}`,
        method: 'get',
        responseType: 'blob'
    })
}

// 删除文件
export function deleteFile(fileId) {
    return request({
        url: `/system/file/${fileId}`,
        method: 'delete'
    })
}